// 有效数字
/**
 * @param {string} s
 * @return {boolean}
 */
 var isNumber = function(s) {
    const graph = {
    0: { blank: 0, sign: 1, ".": 2, digit: 6 },
    1: { digit: 6, ".": 2 },
    2: { digit: 3 },
    3: { digit: 3, E: 4,e:4 },
    4: { digit: 5, sign: 7 },
    5: { digit: 5 },
    6: { digit: 6, ".": 3, E: 4 ,e:4},
    7: { digit: 5 },
  };

  let state = 0;

  for (let c of s.trim()) {
    if (c >= "0" && c <= "9") {
      c = "digit";
    } else if (c === "+" || c === "-") {
      c = "sign";
    }

    state = graph[state][c];

    if (state === void 0) {
      return false;
    }
  }

  if ([3, 5, 6].includes(state)) {
    return true;
  }

  return false;
}